﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MongoDB.Driver;
using BlueLotus7.CDKey.Properties;
using MongoDB.Driver.Builders;

namespace BlueLotus7.CDKey
{
    public static class Extensions
    {
        private static int CompareApplicationName(ApplicationName name1, ApplicationName name2)
        {
            return name1.Key.CompareTo(name2.Key);
        }

        private static int CompareCDKeyObject(CDKeyObject obj1, CDKeyObject obj2)
        {
            return obj1.ApplicationName.CompareTo(obj2.ApplicationName);
        }

        public static void SortByName(this List<ApplicationName> list)
        {
            list.Sort(CompareApplicationName);
        }

        public static void SortByName(this List<CDKeyObject> list)
        {
            list.Sort(CompareCDKeyObject);
        }
    }
}
